# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>

pkgname=perlbrew
pkgver=0.96
pkgrel=2
pkgdesc='Manage perl installations in your $HOME'
arch=('any')
url="https://metacpan.org/release/App-perlbrew"
license=('MIT')
depends=('perl' 'perl-capture-tiny' 'perl-cpan-perl-releases' 'perl-devel-patchperl'
         'perl-file-path-tiny' 'perl-local-lib')
makedepends=('perl-module-build-tiny')
checkdepends=('perl-test-exception' 'perl-test-output' 'perl-test-spec'
              'perl-path-class' 'perl-io-all')
options=('!emptydirs')
source=("https://search.cpan.org/CPAN/authors/id/G/GU/GUGOD/App-perlbrew-$pkgver.tar.gz")
sha1sums=('b2d09c6bfa2cb2b9275fcae15286d2bb1d98cbc7')
sha256sums=('f5dbfad96f5a930b05d52cdc4155d9c0ce854c9fadc24696b661abba2289279a')

build() {
  cd App-perlbrew-$pkgver
  unset PERL5LIB PERL_MM_OPT PERL_MB_OPT PERL_LOCAL_LIB_ROOT
  export PERL_MM_USE_DEFAULT=1 MODULEBUILDRC=/dev/null
  perl Build.PL
  ./Build
}

package() {
  cd App-perlbrew-$pkgver
  unset PERL5LIB PERL_MM_OPT PERL_MB_OPT PERL_LOCAL_LIB_ROOT
  ./Build install --installdirs=vendor --destdir="$pkgdir"
  install -Dm0644 LICENSE "$pkgdir"/usr/share/licenses/perlbrew/LICENSE
}
